package com.kevin.session;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

import com.kevin.session.defaults.DefaultSqlSessionFactory;

public class SqlSessionFactoryBuilder {
	public SqlSessionFactory build(InputStream inputStream){
		try {
			InputStreamReader reader = new InputStreamReader(inputStream,"UTF-8");
			XMLConfigBuilder builder = new XMLConfigBuilder(reader);
			Configuration configuration = builder.parse();
			return new DefaultSqlSessionFactory(configuration);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}	
		return null;
	}
	
	public SqlSessionFactory build(Reader reader){
		return null;
		
	}
	public SqlSessionFactory build(Configuration configuration){
		return new DefaultSqlSessionFactory(configuration);
	}
}
